<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>四川省工程建设领域项目信息、信用信息公开维护平台</title>
<link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/css/reset.css" />
<link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/css/main.css" />
<script type="text/javascript" src="<%=request.getContextPath()%>/scripts/My97DatePicker4/WdatePicker.js"></script>
<script src="<%=request.getContextPath()%>/scripts/jquery-latest.pack.js"></script>
<script src="<%=request.getContextPath()%>/scripts/jquery.form.js"></script>
<script type="text/javascript">
function check(f){
	if (f.account.value == ""){
		alert("必须填写帐号");
		f.account.focus();
		return false;
	}
	if (f.userName.value == ""){
		alert("必须填写姓名");
		f.userName.focus();
		return false;
	}
	if (f.userPwd.value == ""){
		alert("必须填写密码");
		f.userPwd.focus();
		return false;
	}
	var oCode = f.orgCode.value.replace('-','');
	if(oCode.indexOf('-')>0){
		alert("请正确组织机构代码");
		return false;
	}
	if ((f.orgCode.value.length <8) || (f.orgCode.value.length >11)){
		alert("请输入完整组织机构代码");
		f.orgCode.focus();
		return false;
	}
	if (f.contacter.value == ""){
		alert("必须填写联系人");
		f.authCode.focus();
		return false;
	}
	
	if (f.phone.value == ""){
		alert("必须填写联系电话");
		f.authCode.focus();
		return false;
	}
	if (f.authCode.value == ""){
		alert("必须填写验证码");
		f.authCode.focus();
		return false;
	}
	f.orgCode.value = f.orgCode.value.replace('-','');


}

function checkAccount(obj)
{
	if (obj.value != "")
	{
		setTimeout(function(){checkAccountDB(obj);}, 2000);
	}
}
function checkAccountDB(obj)
{
	var options={type:"POST", 
				url:"<%=request.getContextPath()%>/user/accountAuth?account="+obj.value, 
				dataType:"json", success: resultResponse};
	$.ajax(options);
}
function resultResponse(data,status) {
	var obj = document.getElementById("acr");
	if(status){
		if (data.result == 0){
			obj.innerHTML='<font color="#669933">本帐号可以使用</font>';
		}
		else{
			obj.innerHTML='<font color="#FF9966">本帐号已存在</font>';
		}
	}
	else{
		obj.innerHTML='<font color="#FFFF00">无法检测帐号</font>';
	}
}

</script>
<%--
	function sendUpdateInfo(userId){
	var userPwd = document.getElementById("userPwd").value;
	var orgName = document.getElementById("orgName").value;
	var email = document.getElementById("email").value;
	var responser = document.getElementById("responser").value;
	var contacter = document.getElementById("contacter").value;
	var phone = document.getElementById("phone").value;
	var account = document.getElementById("account").value;
	var userName = document.getElementById("userName").value;
	var orgCode = document.getElementById("orgCode").value;
	var estDate = document.getElementById("estDate").value;
	var companyAddr = document.getElementById("companyAddr").value;
	
	var options={type:"POST", 
			url:"<%=request.getContextPath()%>/admin/saveUserInfo?userId="+userId, 
			dataType:"json",
			data: {'userPwd':userPwd, 'orgName':orgName, 'email':email, 'responser':responser,
				   'contacter':contacter, 'phone':phone, 'account':account, 'userName':userName,
				   'orgCode':orgCode, 'estDate':estDate, 'companyAddr':companyAddr},
			success: feedback};
	$.ajax(options);
	
}
function feedback(data,status){
	if(data.result == 0){
		alert("保存成功！");
		
	}else{
		alert("保存失败！");
	}
	
}
 --%>
</head>
<body>
<form method="post" action="<%=request.getContextPath()%>/admin/saveUserInfo?userId=${user.userID}" onsubmit="return check(this);">
<table class="top">
  <tr>
    <td width="40" class="topl"></td>
    <td width="840"><div class="plat_title"><img src="<%=request.getContextPath()%>/images/toptitle.gif" /></div></td>
    <td width="21"><a href="#" class="top_drop_btn"></a></td>
    <td width="20"><a href="#" class="maxbtn"></a></td>
    <td width="29"><a href="#" class="closebtn"></a></td>
  </tr>
</table>
<table class="content">
  <tr>
    <td class="main_l"></td>
    <td class="main_lbar"></td>
    <td width="918" valign="top">
	<div class="banner"><img src="<%=request.getContextPath()%>/images/banner.jpg" /></div>
	<div class="op_con">
    <table class="regtable">
  <tr>
<th colspan="2">修改用户信息</th>
  </tr>
  <tr>
  <td colspan="2"></td>
  </tr>
 
  <tr>
    <td class="w02">帐号</td>
    <td><input type="text" class="intt" id="account" name="account" value="${user.userAccount}" onblur="checkAccount(this)"/><b>*</b><span id="acr"></span></td>
  </tr>
  <tr>
    <td class="w02">姓名</td>
    <td><input type="text" class="intt" id="userName" name="userName" value="${user.userName}"/><b>*</b></td>
  </tr>
  <tr>
    <td class="w02">密码</td>
    <td><input type="text" class="intt" id="userPwd" name="userPwd" value="${user.userPassword}"/><b>*</b></td>
  </tr>
  <tr>
    <td class="w02">用户类型</td>
    <td><input type="text" class="intt" id="userType" name="userType" value="${user.userType}"/><b>*</b></td>
  </tr>
  <tr>
    <td class="w02">组织机构代码</td>
    <td><input type="text" class="intt" id="orgCode" name="orgCode" value="${user.orgCode}" maxlength="11"/><b>*</b><span>请输入8-11位有效数字或字母</span></td>
  </tr>
  <tr>
    <td class="w02">组织机构名称</td>
    <td><input type="text" class="intt" id="orgName" name="orgName" value="${user.orgName}" maxlength="50"/></td>
  </tr>
    <tr>
    <td class="w02">电子邮件</td>
    <td><input type="text" class="intt" id="email" name="email" value="${user.email}" maxlength="50"/><span>找回密码必填</span></td>
  </tr>
  <tr>
    <td class="w02">成立时间</td>
    <td><input type="text" class="intt" id="estDate" name="estDate" value="${user.estDate}" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd'})"/></td>
  </tr>
  <tr>
    <td class="w02">法人代表</td>
    <td><input type="text" class="intt" id="responser" name="responser" value="${user.responser}" maxlength="50"/></td>
  </tr>
  <tr>
    <td class="w02">公司地址</td>
    <td><input type="text" class="intt" id="companyAddr" name="companyAddr" value="${user.companyAddr}" maxlength="50"/></td>
  </tr>
  <tr>
    <td class="w02">公司联系人</td>
    <td><input type="text" class="intt" id="contacter" name="contacter" value="${user.contacter}" maxlength="50"/><b>*</b></td>
  </tr>
  <tr>
    <td class="w02">联系电话</td>
    <td><input type="text" class="intt" id="phone" name="phone" value="${user.phone}" maxlength="50"/><b>*</b></td>
  </tr>

  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;&nbsp;&nbsp;&nbsp;
    <input style="margin:0 0 0 5px;" type="submit" value="保存" class="btn40"/></td>
  </tr>
    <tr>
  <td colspan="2"></td>
  </tr>
</table>

	</div>
	</td>
    <td class="main_rbar"></td>
	<td class="main_r"></td>
  </tr>
</table>
</form>
<table class="bot">
	<tr>
		<td width="41"><div class="botl"></div></td>
		<td width="867"></td>
		<td width="42"><div class="exit"></div></td>
	</tr>
</table>
<c:import url="/foot.jsp" />
</body>
</html>
